# Makefile for making GDS files.
# Normally you only need to supply a C++ source file (e.g. myfile.cc) and
# add the corresponding name of the GDS file in the variable below (e.g.
# myfile.gds).
# Typing 'make' (from appropriate directory in shell) should compile and run the program, 
# producing the GDS file.
# Typing 'make clean' should remove all cif files and all executables and
# backup files.
#
# Xaveer Leijtens 04/03/22


# Enter the basename of your input <BaseName>.cc and output <BaseName>.gds
GDS	      = POEM_test_narrow_p_metal.gds
#               You can put more than one file here, separated by a space.

PROG	      = $(GDS:.gds=)

# path to libmask files here
# currently set for folder libmask, which should be in the parent directory
CXXFLAGS      = -s -I../maskV6_00 -I../libMask_UCSB
LDFLAGS       = -L../maskV6_00

LIBS          = -lGds

CXX	      = g++
LD	      = g++

all:		$(GDS)

clean:		
		rm -f $(GDS) $(PROG) *~ *.bak

$(GDS): 	%.gds: %
		@echo "Executing to make GDS file $@ ..."
		./$< 2>&1 1> $@ 
		@echo "done executing."

$(PROG):	%: %.cc Makefile
		@echo "Compiling $< ..."
		$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
		@echo "done compiling."
